package com.test.reactor.thread;
//消费者
public class C extends Thread {

    private String lock;

    public C(String lock) {
        super();
        this.lock = lock;
    }
    
    @Override
    public void run() {
        while (true) {
            try {
                synchronized (lock) {
                    if (ValueObject.value.equals("")) {//如果字符串为空，即被消费完了，所以wait等待。
                        lock.wait();
                    }
                    System.out.println("get的值是" + ValueObject.value);
                    ValueObject.value = "";
                    lock.notify();
                }

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}